<?php
require_once '/../Controleur/Forum_controleur.php';
require_once '/../Controleur/User_controleur.php';
?>
<!--<div class="divConstruction"><img class="construction" src="src/Vue/images/enConstruction.png"  alt="En construction" /></div>-->

<div class="Forum_vue">
    <h3>Forum Mapping Dead</h3>
    <?php
//    echo $_SESSION['statut'] ;
    $listeSection = Forum_controleur::afficherListeSection();
    //AFFICHAGE des sections
    if (!isset($_GET['idSection']) && !isset($_GET['idTopic'])) {
        ?>
        <h3>Sections</h3>
        <div id="forumSection">
            <table id='section' border="1">
                <?php
                foreach ($listeSection as $section) {
                    $idSection = $section->getIdForumSection();
                    $nomSection = $section->getNomSection();
                    $dateCreation = $section->getDateCreation();
                    $resumeSection = $section->getResumeSection();
                    ?>
                <form  method='POST' action ='Topic_vue.php'><input type="hidden" name="idSection" value="<?php echo $idSection ?>"/>
                    <tr><td><a onclick="page('Topic_vue')"  href="?idSection=<?php echo $idSection; ?>"><?php echo $nomSection; ?></a><td><?php echo $resumeSection ?> </td></tr>
                    <input type="hidden" name="idTopic" value="<?php echo $idSection ?>"/></form>
                <?php } 
    }?></table>

        </div>
        <!--Fin de l'affichage des Sections-->
  
    </div>

    <script>
        function page(nomPage) {

		var chemin = 'src/Vue/'+nomPage+'.php';
		$.ajaxSetup({async: false});
		$.post("src/Vue/session.php",{"chemin" : chemin});		
		$.ajaxSetup({async: true});
                $("#contenu").load('src/Vue/'+nomPage+'.php');
                if(nomPage == "User_vue" || nomPage == "Carte_vue") {
			location.reload();
		}
            }

    </script>